﻿<html>
  <title>Giai phuong trinh bac 2</title>
  

<FORM METHOD = POST ACTION="#">
<center>
  <h1><b><font color="black">Giai phuong trinh bac 2: Ax*x + Bx + C = 0<BR><HR WIDTH=20%></font></b></h1>
  <b><i><font color= "blue">Nhap vao A:</font></i></b>
  <INPUT  TYPE= "char" NAME ="A" SIZE="20" >
        <BR><BR>
  <b><i><font color= "blue">Nhap vao B:</font></i></b>
  <INPUT  TYPE= "char" NAME ="B" SIZE="20" >
        <BR><BR>
   <b><i><font color= "blue">Nhap vao C:</font></i></b>
  <INPUT  TYPE= "char" NAME ="C" SIZE="20" >
       <BR><BR>  
  <input type="submit" name="" value="giai phuong trinh">
  <input type="reset" name="" value="Xoa">
       <BR><BR>
 
 
<font color="BLUE">
	 <?php
  if(isset ($_POST["A"])&& isset($_POST["B"])&&isset($_POST["C"]))
    {
 $A=$_POST["A"];
 $B=$_POST["B"]; 
 $C=$_POST["C"];
	CLASS PHUONGTRINHBAC2
	   {
	        PUBLIC  $A;
		    PUBLIC  $B;
		    PUBLIC  $C;
            PUBLIC   FUNCTION  PHUONGTRINHBAC2($A,$B,$C)
			      {
				       $this->A=$A;
					   $this->B=$B;
					   $this->C=$C;			  
				  }
			PUBLIC   FUNCTION   __DESTRUCT(){}			
			PUBLIC   FUNCTION   INDL()
			      {
				       ECHO "<br>A = ".$this->A;
					   ECHO "<br>B = ".$this->B;
					   ECHO "<br>C = ".$this->C;				  
				  }
			PUBLIC   FUNCTION   GIAI()
			      {		 
                 
                      IF($this->A==NULL && $this>B==NULL && $this->C==NULL)
                         { 
					         ECHO " y/c nhap gia tri";    
							 RETURN;   
					     } 
	
                      IF($this->A==0&&$this->B==0&&$this->C==0)
                         {  
						     ECHO "<br> gia tri khong dung";
						     RETURN;
						 }                    
                
                           IF($this->A==0)
                                {
								       ECHO "<br>";
                                 IF($this->B==0)
                                     { ECHO " PTVN";}
                                 IF($this->C==0)
                                     { ECHO "PTVSN";}  
                                 IF($this->B!=0&& $this->C!=0)
                                     { 
									    ECHO "<BR> PT co nghiem: ";
                                        $X=-$this->C/$this->B;
                                        ECHO "x = ".$X;    
                                      }
								}
                  
                          IF($this->A!=0)
                             {
	                              $DELTA=$this->B*$this->B-4*$this->A*$this->C;    
	                              
		
                                    IF($DELTA<0)      
	                                   {
		                                       ECHO "<BR> PTVN";
		                               }
		                            IF($DELTA==0)         
		                               {   
									       ECHO "<BR> PT co nghiem: ";
		                                   $X=-$this->B/(2*$this->A);
			                                   ECHO "<BR> X1 = X2 = ".$X;
		                                }
		                            IF($DELTA>0)
		                                {
										    ECHO "<BR>PT co nghiem: ";
		                                    $X1=(-$this->B+ sqrt($DELTA))/(2*$this->A);
			                                    ECHO "<BR> X1 = ".$X1;
			                                $X2=(-$this->B-sqrt($DELTA))/(2*$this->A);
			                                    ECHO "<BR> X2 = ".$X2;
		                                } 
	                           }
                   }
		}
$GIAI= NEW PHUONGTRINHBAC2($A,$B,$C);
$GIAI->INDL();
$GIAI->GIAI();

   }		
    ?>	
